<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>职位管理</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li><a href="javascript:void(0);">系统管理</a></li>
    <li><a href="javascript:void(0);">职位管理</a></li>
    <li><a href="javascript:void(0);">修改</a></li>
  </ul>
</div>
<div class="formbody">
  <div class="formtitle"><span>职位信息</span></div>
  <form id="updateJob" th:action="@{/sys/job/doUpdate}" method="post">
  <input type="hidden" name="jobId" th:value="${job.jobId}"/>
  <ul class="forminfo">
    <li>
      <label>职位名称</label>
      <input id="jobName" name="jobName" type="text" th:value="${job.jobName}" class="dfinput" />
      <i>必填，不能超过30个字符</i>
    </li>
    <li> <label>所属部门：</label>
      <select id="jobDeptId" name="jobDeptId" class="dfselect">
        <option value="">请选择部门</option>
        <option th:each="d:${session.dlist}" th:value="${d.deptId}" th:text="${d.deptName}" th:selected="${d.deptId==job.jobDeptId}">研发</option>
      </select>
    </li>
    <li>
      <label>&nbsp;</label>
      <input onclick="updateJob()" type="button" class="btn" value="确认保存"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="button" class="btn" value="返回"  onclick="window.history.go(-1);"/>
    </li>
  </ul>
  </form>

  <!--修改职位表单验证-->
  <script>
    $(function () {
      $("#jobName").blur(function () {
        ckjobName();
      });
      $("#jobDeptId").blur(function () {
        ckjobDeptId();
      });
    });
    function ckjobName() {
      if($("#jobName").val()==""){
        return false;
      }else{
        return true;
      }
    }
    function ckjobDeptId() {
      if($("#jobDeptId").val()==""){
        return false;
      }else{
        return true;
      }
    }
    function updateJob() {
      if(ckjobName()&&ckjobDeptId()){
        $("#updateJob").submit();
      }else{
        confirm("修改职位失败！");
      }
    }
  </script>
</div>
</body>
</html>
